public class Example7_7 {
   public static void main(String args[]) {
      CargoBoat ship1 = new CargoBoat();
      ship1.setMaxContent(1000);
     CargoBoat2 ship2 = new CargoBoat2();

      ship2.setMinContent(332);

      int m =600;
      try{  
           ship1.loading(m);
           m = 400;
           ship1.loading(m);
           m = 367;
           ship1.loading(m);
           m = 555;
           ship1.loading(m);
      }
      catch(DangerException e) {
           System.out.println(e.warnMess()); 
           System.out.println("无法再装载重量是"+m+"吨的集装箱");       
      }
      int n =700;
      try{
           ship2.loading(n);
           m = 400;
           ship2.loading(n);
           m = 367;
           ship2.loading(n);
           m = 555;
           ship2.loading(n);
      }

       catch(DangerException2 e) {
           System.out.println(e.warnMess());
           System.out.println("无法再装载重量是"+n+"吨的集装箱");
      }

      finally {
          System.out.printf("货船将正点启航");
      }
  }
}
